home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / a_utils / expanded.lha / expanded / hdr / Geom.h next >
C/C++ Source or Header  |  1992-03-19  |  39KB  |  1,434 lines

  1. //
  2. // Linear-Affine-Projective Geometry Package
  3. //
  4. // Geom.h
  5. //
  6. // $Header$
  7. //
  8. // William J.R. Longabaugh 
  9. // University of Washington
  10. //
  11. // Implementation of the linear-affine-projective geometry
  12. // package described in William J.R. Longabaugh, "An Expanded
  13. // System for Coordinate-Free Geometric Programming", Master's 
  14. // thesis, University of Washington, 1992.
  15. //
  16. // Copyright (c) 1992, William J.R. Longabaugh
  17. //   Copying, use and development for non-commercial purposes permitted.
  18. //   All rights for commercial use reserved.
  19. //   This software is unsupported and without warranty; it is
  20. //   provided "as is".
  21. //
  22. // ***********************************************************************
  23.  
  24. #ifndef Geom_h
  25. #define Geom_h
  26.  
  27. #include <stream.h>
  28. #include <string.h>
  29. #include "Lap1.h"
  30. #include "Object.h"
  31. #include "Matrix.h"
  32.  
  33. // ***********************************************************************
  34. //
  35. // IMPORTANT NOTES:
  36. //
  37. // Inheritance:
  38. //
  39. //   The use of inheritance in this class hierarchy is unusual, but
  40. // was dictated by the goals that were set for the implementation, and
  41. // the desire to keep things as simple as possible.  The generic
  42. // base classes (e.g. Map, Space, GeOb, Basis, MultiMap, SubSet)
  43. // serve as the main classes in the system.  While these base classes
  44. // also have child classes, child classes are really only included to
  45. // provide static types and automatic typecasting.  Child classes are
  46. // NOT being used to factor out implementation details that are unique
  47. // to a particular type of class.  In this system, the generic base
  48. // classes implements most of the functionality, and the child
  49. // classes just implement a few things like constructors and assignment.
  50. //   This approach was intended to give the system a measure of dynamic
  51. // typing, while trying to keep the implementation as simple as possible.
  52. // For example, an object from the generic Map class can hold
  53. // any type of map (Affine, Linear, or Projective), and since the generic
  54. // base class Map implements all the functions for the various types
  55. // of maps it can hold, no downcasting is necessary.
  56. //   There are a few instances where specific functionality has been
  57. // factored into the child classes.  The GeOb's MapTo() function and the
  58. // Space's SetSpace() function are two examples.  In these instances, the
  59. // functions are implemented as virtual functions, and the implementation
  60. // in the generic base classes just does downcasting.  This is one
  61. // way in which some amount of the implementation details can be
  62. // moved down into the child classes.  However, given the goals that
  63. // were set down for the implementation, it seems that it would be
  64. // very difficult to make a system using C++ where the base classes
  65. // didn't need to know something about their child classes.
  66. //   For more discussion of this issue, consult the thesis writeup. 
  67. //   
  68. // Friend classes:
  69. //
  70. //   The user will note that friend classes are used liberally in 
  71. // this implementation.  This arises out of the desire to prevent
  72. // the user from having access to the functions that the implementing
  73. // classes use to work together.  The only real way to do this in C++
  74. // is to make the classes friends of each other.  However, friend
  75. // classes still are designed to only interact using member functions
  76. // (albeit private functions), and not by accessing data directly.
  77. // This policy is not enforced by the compiler, but by programming
  78. // convention.
  79. //
  80. // Compiler:
  81. //
  82. //   This system has compiled and run successfully using CFRONT 1.2.
  83. // It was also designed to work with g++, specifically version 1.37.1
  84. // (which is what was on the CSE department Sun workstations during
  85. // development).  Some apparent g++ bugs (such as inheritance of
  86. // assignment) have workarounds in the code.  However, there continue
  87. // to be problems with g++, particularly with abnormal destructor calls
  88. // that show up with matrices (size > 4) that need to use the heap.
  89. // Thus, the use of g++ 1.37.1 IS NOT RECOMMENDED, except to do debugging
  90. // using gdb, and then only with small dimension matrices.  For more
  91. // discussion, see the thesis writeup. 
  92. //
  93. // Efficiency:
  94. //
  95. //   This implementation is really only a "first cut".  The goal for the
  96. // project was to build a correct implementation of the ADT and do it as
  97. // simply as possible.  Unfortunately, efficiency considerations typically
  98. // took a back seat, and the next logical step in the process would be to
  99. // find the bottlenecks in the implementation and work to improve their
  100. // efficiency.  There are undoubtedly LOTS of ways to speed up the
  101. // system.  In fact, some aspects of this implementation are embarassingly
  102. // inefficient.
  103. //   However, some relatively simple steps can be taken to improve
  104. // performance.  For example, the implementing classes use many of the
  105. // the same functions that are provided to the user.  While this made
  106. // the system easy to implement, it takes a big toll on performance, since
  107. // the user interface functions do lots of safety checks and necessary
  108. // type conversions, and return their results (functional semantics).
  109. // While functional semantics is a nice property, it does result in lots
  110. // of object copying.  The preferable alternative would be to provide the
  111. // implementing classes with special functions that do not include these
  112. // features.  For example, instead of using the functions
  113. // 
  114. //       Boolean GeOb::CanMapTo(GeObType t);
  115. //       GeOb GeOb::MapTo(GeObType t);
  116. //      GeOb Map::operator()(GeOb& v);
  117. //     Boolean SubSet::IsIn(GeOb& g);
  118. // 
  119. // in the implementation to check and change GeOb representations, there
  120. // should be functions available ONLY to the implementing classes that
  121. // reduce copying and remove some safety checks, e.g.
  122. //
  123. //      Boolean GeOb::MapTo(GeObType t, GeOb* out);
  124. //      GeOb Map::Apply(GeOb& v, GeOb* out);
  125. //      Boolean SubSet::IsInNoCast(GeOb& g);
  126. //
  127. // The first function would fill in the target GeOb with the mapped
  128. // GeOb if it could, or would return FALSE if the mapping could not be
  129. // performed.  The second would apply a map, but would assume the
  130. // argument is of the correct type.  Perhaps it might also assume
  131. // that the argument is in the domain (i.e. it would require the
  132. // caller to check CanMap() first).  The third function would also
  133. // assume its argument is of the correct type.  Using functions like
  134. // these in the implementation layer can go a long way to improving 
  135. // efficiency.  Of course, it means more functions to implement and
  136. // fewer safeguards.
  137. //
  138. // ***********************************************************************
  139.  
  140. class Space: public Object
  141. {
  142.   protected:
  143.  
  144. // Object Data:
  145.  
  146.     SpaceType type;
  147.     SpaceType holds;
  148.     SpaceInfo *info;
  149.  
  150. // Functions used only by Space & derived classes.  VSpace must be made
  151. // a friend under g++ (not CFRONT 1.2) to access the functions tagged
  152. // by **:
  153.  
  154.     friend class VSpace;
  155.  
  156.     void MergeSets(Space& set2);         // **
  157.     void SetSpaceSet(SRel s, Space& s);  // **
  158.     void SetDual(Space& s);              // **
  159.     char* BuildTagName(char* tag, Space& s);
  160.     void DestroyTagName(char* buf);
  161.     void CopyDebugName(char* buf);
  162.     void BuildEuclidean(Boolean eflag);
  163.     void Broadcast(SRel s, Space& ins);
  164.     void SetStdLMap(Map& m);
  165.     void SetStdAMap(SRel s, Map& m);
  166.     void SetStdPMap(Map& m);
  167.     Boolean HaveLink(Space& s1, SRel r1,
  168.              Space& s2, SRel r2, Boolean* have_error);
  169.  
  170.         void LinkLT(void);
  171.         void LinkAP(AffineMap& m);         // 1
  172.     void LinkLA(AffineMap& m);         // 2
  173.     void LinkLP(ProjectiveMap& m);         // 3
  174.     void LinkLAHaveLP(AffineMap& m);     // 4
  175.     void LinkAPHaveLP(AffineMap& m);     // 5
  176.     void LinkLAHaveAP(AffineMap& m);     // 6
  177.     void LinkAPHaveLA(AffineMap& m);     // 7
  178.     void LinkLPHaveLA(ProjectiveMap& m); // 8
  179.     void LinkLPHaveAP(ProjectiveMap& m); // 9
  180.     void data_out(ostream& c, int indent, char* name);
  181.     void heavy_data_out(ostream& c, int indent, char* name);
  182.  
  183. // Functions also used by friend classes.  Though the compiler cannot
  184. // enforce it, friend classes (by convention) do not access any other
  185. // private members of this class.  Cross ratio functions also need to 
  186. // be friends:
  187.  
  188.  
  189.     friend class Basis;
  190.     friend class Simplex;
  191.     friend class Frame;
  192.         friend class VBasis;
  193.         friend class HFrame;
  194.         friend class GeOb;
  195.         friend class Vector;
  196.         friend class AVector;
  197.         friend class VectorEC;
  198.         friend class APoint;
  199.         friend class AVectorEC;
  200.         friend class PPoint;
  201.         friend class Map;
  202.         friend class AffineMap;
  203.         friend class ProjectiveMap;
  204.         friend class MultiMap;
  205.         friend class MLM;
  206.         friend class MAM;
  207.         friend class SubSet;
  208.         friend class ASubSet;
  209.         friend class PSubSet;
  210.     friend PPoint    CrossRatio(AugScalar v, GeObList& g);
  211.     friend AugScalar CrossRatioCalc(GeObList& g);
  212.  
  213.     int            MatrixSize(void);
  214.     int            StartSlot(int n);
  215.     Matrix&        HoistTangent(void);
  216.     AffineMap&     AffineMapToRef(SRel s);
  217.     ProjectiveMap& ProjectiveMapToRef(SRel s);
  218.     LinearMap&     LinearMapToRef(SRel s);
  219.  
  220.   public:
  221.  
  222. // Creation:
  223.  
  224.     Space(void);
  225.         Space(Space& v);
  226.  
  227. // Interrogation functions:
  228.  
  229.     int           Dim(void);
  230.     char*         Name(char *buf);
  231.         SpaceType     Holds(void)   {return holds;}
  232.     Basis         StdBasis(void);
  233.     SRel          SpaceRelation(Space& s);
  234.     SRel          ThisSpaceIs(void);
  235.     Boolean       HasSpace(SRel s);
  236.     Space         GetSpace(SRel s);
  237.         SubSet        FullSet(void);
  238.     GeObType      NativeType(void);
  239.     AffineMap     AffineMapTo(SRel s);
  240.     ProjectiveMap ProjectiveMapTo(SRel s);
  241.     LinearMap     LinearMapTo(SRel s);
  242.     VSpace        Dual(void);
  243.     Simplex       StdSimplex(void);
  244.     Boolean       IsEuclidean(void);
  245.     MLM           InnerProduct(void);
  246.     MLM           CrossProduct(void);
  247.     GeObList      PtsAtInfinity(void);
  248.         PSubSet       FullProjSet(void);
  249.     ASubSet       StdAffineSubset(void);
  250.  
  251. // Space set building:
  252.  
  253.     virtual Space SetSpace(Space& s, Map& m);
  254.  
  255. // Comparison operators:
  256.  
  257.     Boolean operator==(Space& s)   {return (info == s.info);}
  258.     Boolean operator!=(Space& s)   {return (info != s.info);}
  259.  
  260. // Cartesian Product Operations:
  261.  
  262.     Space operator[](int n);
  263.     int   CPSpaceSize(void);
  264.  
  265. // Assignment:
  266.  
  267.         Space& operator=(Space& s);
  268.  
  269. // To do debug printing:
  270.  
  271.         void debug_out(ostream& c, int indent);      
  272.         void heavy_debug_out(ostream& c, int indent);      
  273. };
  274.  
  275. // ***********************************************************************
  276.  
  277. class VSpace: public Space
  278. {
  279.   private:
  280.  
  281. // Functions also used by friend classes.  Though the compiler cannot
  282. // enforce it, friend classes (by convention) do not access any other
  283. // private members of this class:  
  284.  
  285.         friend class Space;
  286.  
  287.     VSpace(SRel s, Space& ins);
  288.  
  289.   public:
  290.  
  291. // Creation:
  292.  
  293.     VSpace(void)       : () {type = VEC_SPACE;}
  294.         VSpace(VSpace& v)  : (v) {type = VEC_SPACE;}
  295.     VSpace(char *namein, int n, Boolean eflag);
  296.     VSpace(char *namein, Boolean eflag, ASpace& a, PSpace& p);
  297.     VSpace(char *namein, Boolean eflag, Space& a);
  298.     VSpace(char *namein, SpaceList& t, Boolean eflag);
  299.     VSpace(Space& s);
  300.  
  301. // Space set building:
  302.  
  303.     Space SetSpace(Space& s, Map& m);
  304.  
  305. // Assignment:
  306.  
  307.         VSpace& operator=(VSpace& s);
  308.  
  309. // To do debug printing:
  310.  
  311.         void debug_out(ostream& c, int indent);      
  312. };
  313.  
  314. // ***********************************************************************
  315.  
  316. class ASpace: public Space
  317. {
  318.   private:
  319.  
  320.     Matrix BuildHoist(int n);
  321.  
  322.   public:
  323.  
  324. // Creation:
  325.  
  326.     ASpace(void)       : () {type = AFF_SPACE;}
  327.         ASpace(ASpace& s)  : (s) {type = AFF_SPACE;}
  328.     ASpace(char *namein, int n, Boolean eflag);
  329.     ASpace(char *namein, Boolean eflag, VSpace& v, PSpace& p);
  330.     ASpace(char *namein, Boolean eflag, Space& ins);
  331.     ASpace(char *namein, SpaceList& t, Boolean eflag);
  332.     ASpace(Space& s);
  333.  
  334. // Space set building:
  335.  
  336.     Space SetSpace(Space& s, Map& m);
  337.  
  338. // Assignment:
  339.  
  340.         ASpace& operator=(ASpace& s);
  341.  
  342. // To do debug printing:
  343.  
  344.         void debug_out(ostream& c, int indent);      
  345. };
  346.  
  347. // ***********************************************************************
  348.  
  349. class PSpace: public Space
  350. {
  351.   public:
  352.  
  353. // Creation:
  354.  
  355.     PSpace(void)       : () {type = PROJ_SPACE;}
  356.         PSpace(PSpace& v)  : (v) {type = PROJ_SPACE;}
  357.     PSpace(char *namein, int n);
  358.     PSpace(char *namein, VSpace& v, ASpace& a);
  359.     PSpace(char *namein, Space& v);
  360.     PSpace(Space& s);
  361.  
  362. // Space set building:
  363.  
  364.     Space SetSpace(Space& s, Map& m);
  365.  
  366. // Assignment:
  367.  
  368.         PSpace& operator=(PSpace& s);
  369.  
  370. // To do debug printing:
  371.  
  372.         void debug_out(ostream& c, int indent);      
  373. };
  374.  
  375. // ***********************************************************************
  376.  
  377. class SubSet: public Object
  378. {
  379.   protected:
  380.  
  381. // Object Data:
  382.  
  383.     SubSetType type;
  384.     SubSetType holds;
  385.     SubSetInfo *info;
  386.  
  387. // Used by only by SubSet & derived classes:
  388.  
  389.     SubSet(SubSetInfo* ts);
  390.     char* BuildTagName(char* tag, SubSet& s);
  391.     char* BuildTagName(char* tag, Space& s);
  392.     void DestroyTagName(char* buf);
  393.     void CopyDebugName(char* buf);
  394.     Boolean     ConvertList(GeObList& v, GeObType targ,
  395.                     Space& destspace, Matrix* temp);
  396.     Matrix      GSO(Matrix& have, Matrix& try, int start,
  397.                 int dim, Boolean* error);
  398.     Boolean     Orth(Matrix* have, int count, Matrix& try, int tryrow);
  399.     Matrix&     AugBasis(void);
  400.     int         IsOffset(void);
  401.     Scalar      Offset(void);
  402.     void data_out(ostream& c, int indent, char* name);
  403.  
  404. // Functions also used by friend classes.  Though the compiler cannot
  405. // enforce it, friend classes (by convention) do not access any other
  406. // private members of this class:  
  407.  
  408.         friend class Map;
  409.         friend class LinearMap;
  410.         friend class AffineMap;
  411.         friend class ProjectiveMap;
  412.  
  413.     Matrix& FromFull(void);
  414.     Matrix& ToFull(void);
  415.     GeOb    Normalize(GeOb&);
  416.     Scalar  NormVal(SubSet& targ);
  417.  
  418.   public:
  419.  
  420. // Constructors:
  421.  
  422.     SubSet(void);
  423.         SubSet(SubSet& s);
  424.  
  425. // Interrogation functions:
  426.  
  427.     char*      Name(char *buf);
  428.     int        Dim(void);
  429.     SubSetType Holds(void)   {return (holds);}
  430.     Space      EmbeddingSpace(void);
  431.     GeObType   Accepts(void);
  432.  
  433.     Boolean    IsIn(GeOb& g);
  434.     Boolean    IsSubset(SubSet& s);
  435.     Boolean    IsFullSpace(void);
  436.     Boolean    HasRemovedPoints(void);
  437.     GeObList   AtInfinity(void);
  438.     VSubSet    TangentSub(void);
  439.  
  440. // Assignment:
  441.  
  442.         SubSet& operator=(SubSet& s);
  443.  
  444. // To do debug printing:
  445.  
  446.         void debug_out(ostream& c, int indent);      
  447. };
  448.  
  449. // ***********************************************************************
  450.  
  451. class VSubSet: public SubSet
  452. {
  453.   private:
  454.  
  455. // Functions also used by friend classes.  Though the compiler cannot
  456. // enforce it, friend classes (by convention) do not access any other
  457. // private members of this class:  
  458.  
  459.         friend class VSpace;
  460.  
  461.     VSubSet(VSpace& s);  // Not intended for casting spaces!
  462.  
  463.   public:
  464.  
  465. // Creation:
  466.  
  467.     VSubSet(void)        : () {type = LINEAR_SUBSET;}
  468.         VSubSet(VSubSet& s)  : (s) {type = LINEAR_SUBSET;}
  469.     VSubSet(SubSet& s);
  470.     VSubSet(char *namein, VSpace& s, GeObList& v);
  471.  
  472. // Assignment:
  473.  
  474.         VSubSet& operator=(VSubSet& s);
  475.  
  476. // To do debug printing:
  477.  
  478.         void debug_out(ostream& c, int indent);      
  479. };
  480.  
  481. // ***********************************************************************
  482.  
  483. class ASubSet: public SubSet
  484. {
  485.   private:
  486.  
  487. // Used by ASubSet:
  488.  
  489.     ASubSet(ASubSet& a, ProjectiveMap&m);
  490.  
  491. // Functions also used by friend classes.  Though the compiler cannot
  492. // enforce it, friend classes (by convention) do not access any other
  493. // private members of this class:  
  494.  
  495.         friend class AffineMap;
  496.         friend class ASpace;
  497.  
  498.     ASubSet(Space& s);    // Not intended for casting spaces!
  499.  
  500.   public:
  501.  
  502. // Creation:
  503.  
  504.     ASubSet(void)       : () {type = AFFINE_SUBSET;}
  505.         ASubSet(ASubSet& s) : (s) {type = AFFINE_SUBSET;}
  506.     ASubSet(SubSet& s);
  507.     ASubSet(char *namein, Space& s, GeObList& v);
  508.     ASubSet(char *namein, PSpace& s, GeOb& v, GeObList& inf);
  509.  
  510. // Assignment:
  511.  
  512.         ASubSet& operator=(ASubSet& s);
  513.  
  514. // To do debug printing:
  515.  
  516.         void debug_out(ostream& c, int indent);      
  517. };
  518.  
  519. // ***********************************************************************
  520.  
  521. class PSubSet: public SubSet
  522. {
  523.   private:
  524.  
  525. // Functions also used by friend classes.  Though the compiler cannot
  526. // enforce it, friend classes (by convention) do not access any other
  527. // private members of this class:  
  528.  
  529.         friend class VSpace;
  530.         friend class PSpace;
  531.  
  532.     PSubSet(Space& s);    // Not intended for casting spaces!
  533.  
  534.   public:
  535.  
  536. // Creation:
  537.  
  538.     PSubSet(void)       : () {type = PROJECTIVE_SUBSET;}
  539.     PSubSet(PSubSet& s)  : (s) {type = PROJECTIVE_SUBSET;}
  540.         PSubSet(SubSet& s);
  541.     PSubSet(char *namein, Space& s, GeObList& v);
  542.     PSubSet(char *namein, Space& s, GeObList& bp, GeObList& v);
  543.  
  544. // Assignment:
  545.  
  546.         PSubSet& operator=(PSubSet& s);
  547.  
  548. // To do debug printing:
  549.  
  550.         void debug_out(ostream& c, int indent);      
  551. };
  552.  
  553. // ***********************************************************************
  554.  
  555. class Basis: public Object
  556. {
  557.   protected:
  558.  
  559. // Object Data:
  560.  
  561.     BasisType  type;        // What type of basis it is.
  562.     BasisType  holds;        // Type of current contents.
  563.     Space   s;                      // The containing space.       
  564.     char    name[MAX_NAMESIZE];     // Name of Basis.
  565.     Matrix  tostdb;                 // Rep. of basis rel. to StdBasis.
  566.     Matrix  fromstdb;               // Rep. of StdBasis rel. to basis.
  567.  
  568. // Used only by Basis class:
  569.  
  570.     Basis(BasisType b, Space& s, char *name, Matrix& m);
  571.     void data_out(ostream& c, int indent, char* name);
  572.  
  573. // Functions also used by friend classes.  Though the compiler cannot
  574. // enforce it, friend classes (by convention) do not access any other
  575. // private members of this class:  
  576.  
  577.         friend class Vector;
  578.         friend class AVector;
  579.         friend class APoint;
  580.         friend class PPoint;
  581.         friend class LinearMap;
  582.         friend class AffineMap;
  583.         friend class ProjectiveMap;
  584.         friend class VSpace;
  585.         friend class ASpace;
  586.         friend class PSpace;
  587.  
  588.         Basis(BasisType b, Space& ins, int size);
  589.     Matrix& Tostdb(void)     {return (tostdb);}
  590.     Matrix& Fromstdb(void)   {return (fromstdb);}
  591.  
  592.   public:
  593.  
  594. // Constructors:
  595.  
  596.     Basis(void) {type = ANY_BASIS; holds = NULL_BASIS;}
  597.         Basis(Basis& b);
  598.  
  599. // Interrogation functions:
  600.  
  601.         Space      SpaceOf(void)     {return (s);}
  602.     BasisType  Holds(void)       {return (holds);}
  603.         char*      Name(char *buf)   {return (strcpy(buf, name));}
  604.  
  605.     GeOb       operator[](int n);
  606.     ScalarList operator()(GeOb& v);
  607.     VBasis     Dual(void);
  608.  
  609. // Assignment:
  610.  
  611.         Basis& operator=(Basis& b);
  612.  
  613. // To do debug printing:
  614.  
  615.         void debug_out(ostream& c, int indent);      
  616. };
  617.  
  618. // ***********************************************************************
  619.  
  620. class Simplex: public Basis
  621. {
  622.   public:
  623.  
  624. // Constructors:
  625.  
  626.     Simplex(void)       : () {type = SIMPLEX;}
  627.         Simplex(Simplex& b) : (b) {type = SIMPLEX;}
  628.     Simplex(char* namein, GeOb& t);
  629.     Simplex(char* namein, ASpace& ins, GeObList& t);
  630.     Simplex(Basis& f);
  631.  
  632. // Assignment:
  633.  
  634.         Simplex& operator=(Simplex& b);
  635.  
  636. // To do debug printing:
  637.  
  638.         void debug_out(ostream& c, int indent);      
  639. };
  640.  
  641. // ***********************************************************************
  642.  
  643. class Frame: public Basis
  644. {
  645.   public:
  646.  
  647. // Constructors:
  648.  
  649.     Frame(void)     : () {type = FRAME;}
  650.         Frame(Frame& f) : (f) {type = FRAME;}
  651.     Frame(char* namein, ASpace& ins, GeObList& t);
  652.     Frame(Basis& f);
  653.     Frame(Simplex& b, int n);
  654.  
  655. // Assignment:
  656.  
  657.         Frame& operator=(Frame& f);
  658.  
  659. // To do debug printing:
  660.  
  661.         void debug_out(ostream& c, int indent);      
  662. };
  663.  
  664. // ***********************************************************************
  665.  
  666. class VBasis: public Basis
  667. {
  668.   public:
  669.  
  670. // Constructors:
  671.  
  672.     VBasis(void)      : () {type = VBASIS;}
  673.         VBasis(VBasis& v) : (v) {type = VBASIS;}
  674.     VBasis(char* namein, GeOb& t);
  675.     VBasis(char* name, VSpace& ins, GeObList& t);
  676.     VBasis(Basis& f);
  677.  
  678. // Assignment:
  679.  
  680.         VBasis& operator=(VBasis& b);
  681.  
  682. // To do debug printing:
  683.  
  684.         void debug_out(ostream& c, int indent);      
  685. };
  686.  
  687. // ***********************************************************************
  688.  
  689. class HFrame: public Basis
  690. {
  691.   public:
  692.  
  693. // Constructors:
  694.  
  695.     HFrame(void)       : () {type = HFRAME;}
  696.         HFrame(HFrame& h)  : (h) {type = HFRAME;}
  697.     HFrame(char* namein, PSpace& ins, GeObList& t);
  698.     HFrame(Basis& f);
  699.  
  700. // Assignment:
  701.  
  702.         HFrame& operator=(HFrame& h);
  703.  
  704. // To do debug printing:
  705.  
  706.         void debug_out(ostream& c, int indent);      
  707. };
  708.  
  709. // ***********************************************************************
  710.  
  711. class GeOb: public Object
  712. {
  713.   protected:
  714.  
  715. // Object Data:
  716.     
  717.     GeObType type;            // The type of geometric object
  718.     GeObType holds;            // The type currently held
  719.     Space  s;                       // The containing space.
  720.     Matrix m;                       // Coords relative to s.stdbasis
  721.  
  722. // Used only by GeOb
  723.  
  724.     void data_out(ostream& c, int indent, char* name);
  725.  
  726. // Functions also used by friend classes.  Though the compiler cannot
  727. // enforce it, friend classes (by convention) do not access any other
  728. // private members of this class:  
  729.  
  730.         friend class Basis;
  731.         friend class Simplex;
  732.         friend class Frame;
  733.         friend class VBasis;
  734.         friend class HFrame;
  735.         friend class Map;
  736.         friend class ProjectiveMap;
  737.         friend class MultiMap;
  738.         friend class MLM;
  739.         friend class MAM;
  740.         friend class SubSet;
  741.  
  742. // Friend declarations required by g++ (not CFRONT 1.2):
  743.  
  744.         friend class Vector;
  745.         friend class AVector;
  746.         friend class VectorEC;
  747.         friend class AVectorEC;
  748.         friend class APoint;
  749.         friend class PPoint;
  750.  
  751.     GeOb(GeObType g, Space& ins, Matrix& inm);
  752.     Matrix& MatrixRep(void)  {return (m);}
  753.  
  754.   public:
  755.  
  756. // Constructors:
  757.  
  758.     GeOb(void) {type = ANY_GEOB; holds = NULL_GEOB;}
  759.         GeOb(GeOb& g);
  760.     GeOb(MultiMap& mp);
  761.     GeOb(Map& mp);
  762.     GeOb(Scalar v);
  763.  
  764. // Interrogation functions:
  765.  
  766.     Space    SpaceOf(void)   {return (s);}
  767.     GeObType Holds(void)     {return (holds);}
  768.     virtual Boolean CanMapTo(GeObType t);
  769.     Boolean  IsZeroVector(void);
  770.     GeOb     operator[](int n);
  771.     GeObList TupleElements(void);
  772.  
  773. // Operations:
  774.  
  775.     friend GeOb   operator-(GeOb& th);
  776.     friend GeOb   operator+(GeOb& th, GeOb& g);
  777.     friend GeOb   operator-(GeOb& th, GeOb& g);
  778.     friend GeOb   operator*(GeOb& th, GeOb& g);
  779.     friend GeOb   operator/(GeOb& th, GeOb& g);
  780.  
  781.     Scalar Apply(GeOb& a);
  782.     GeOb   Dual(void);
  783.     virtual GeOb MapTo(GeObType t);
  784.     GeOb   SetTupleElement(int n, GeOb& g);
  785.  
  786. // Cross ratio functions are friends:
  787.  
  788.     friend PPoint    CrossRatio(AugScalar v, GeObList& g);
  789.     friend AugScalar CrossRatioCalc(GeObList& g);
  790.  
  791. // Manual typecasting:
  792.  
  793.         Scalar ToScalar(void);
  794.  
  795. // Assignment:
  796.  
  797.         GeOb& operator=(GeOb& g);
  798.  
  799. // To do debug printing:
  800.  
  801.         void debug_out(ostream& c, int indent);      
  802. };
  803.  
  804. //  ***********************************************************************
  805.  
  806. class Vector: public GeOb
  807. {
  808.   public:
  809.  
  810.     Vector(void)      : () {type = VECTOR;}
  811.         Vector(Vector& v) : (v) {type = VECTOR;}
  812.     Vector(GeOb& a)   : (a.MapTo(VECTOR)) {type = VECTOR;}
  813.     Vector(MultiMap& mp) {type = VECTOR; *this = Vector(GeOb(mp));}
  814.     Vector(Map& mp)      {type = VECTOR; *this = Vector(GeOb(mp));}
  815.     Vector(Scalar s)  : (s) {type = VECTOR;}
  816.     Vector(VBasis& b, ScalarList& a);
  817.     Vector(VSpace& s, GeObList& s);
  818.     Vector(VSpace& s, GeOb& v1, GeOb& v2);
  819.     Vector(VSpace& s, GeOb& v1, GeOb& v2, GeOb& v3);
  820.  
  821. // Mapping:
  822.  
  823.     virtual Boolean CanMapTo(GeObType t);
  824.     virtual GeOb MapTo(GeObType t);
  825.  
  826. // Assignment:
  827.  
  828.         Vector& operator=(Vector& s);
  829.  
  830. // To do debug printing:
  831.  
  832.         void debug_out(ostream& c, int indent);      
  833. };
  834.  
  835. // ***********************************************************************
  836.  
  837. class AVector: public GeOb
  838. {
  839.   public:
  840.  
  841. // Constructors:
  842.  
  843.     AVector(void)       : () {type = AFF_VECTOR;}
  844.         AVector(AVector& v) : (v) {type = AFF_VECTOR;}
  845.     AVector(GeOb& a)    : (a.MapTo(AFF_VECTOR)) {type = AFF_VECTOR;}
  846.     AVector(MultiMap& mp) {type = AFF_VECTOR; *this = AVector(GeOb(mp));}
  847.     AVector(Map& mp)      {type = AFF_VECTOR; *this = AVector(GeOb(mp));}
  848.     AVector(Basis& b, ScalarList& a);
  849.     AVector(VSpace& s, GeObList& s);
  850.     AVector(VSpace& s, GeOb& v1, GeOb& v2);
  851.     AVector(VSpace& s, GeOb& v1, GeOb& v2, GeOb& v3);
  852.  
  853. // Mapping:
  854.  
  855.     virtual Boolean CanMapTo(GeObType t);
  856.     virtual GeOb MapTo(GeObType t);
  857.  
  858. // Assignment:
  859.  
  860.         AVector& operator=(AVector& g);
  861.  
  862. // To do debug printing:
  863.  
  864.         void debug_out(ostream& c, int indent);      
  865. };
  866.  
  867. // ***********************************************************************
  868.  
  869. class VectorEC: public GeOb
  870. {
  871.   public:
  872.  
  873. // Constructors:
  874.  
  875.     VectorEC(void)         : () {type = VEC_EC;}
  876.         VectorEC(VectorEC& v)  : (v) {type = VEC_EC;}
  877.     VectorEC(GeOb& a)      : (a.MapTo(VEC_EC)) {type = VEC_EC;}
  878.     VectorEC(MultiMap& mp) {type = VEC_EC; *this = VectorEC(GeOb(mp));}
  879.     VectorEC(Map& mp)      {type = VEC_EC; *this = VectorEC(GeOb(mp));}
  880.  
  881. // Mapping:
  882.  
  883.     virtual Boolean CanMapTo(GeObType t);
  884.     virtual GeOb MapTo(GeObType t);
  885.  
  886. // Assignment:
  887.  
  888.         VectorEC& operator=(VectorEC& g);
  889.  
  890. // To do debug printing:
  891.  
  892.         void debug_out(ostream& c, int indent);      
  893. };
  894.  
  895. // ***********************************************************************
  896.  
  897. class AVectorEC: public GeOb
  898. {
  899.   public:
  900.  
  901. // Constructors:
  902.  
  903.     AVectorEC(void)         : () {type = AFF_VEC_EC;}
  904.         AVectorEC(AVectorEC& v) : (v) {type = AFF_VEC_EC;}
  905.     AVectorEC(GeOb& a)      : (a.MapTo(AFF_VEC_EC)) {type = AFF_VEC_EC;}
  906.     AVectorEC(MultiMap& mp) {type=AFF_VEC_EC; *this = AVectorEC(GeOb(mp));}
  907.     AVectorEC(Map& mp)    {type = AFF_VEC_EC; *this = AVectorEC(GeOb(mp));}
  908.  
  909. // Mapping:
  910.  
  911.     virtual Boolean CanMapTo(GeObType t);
  912.     virtual GeOb MapTo(GeObType t);
  913.  
  914. // Assignment:
  915.  
  916.         AVectorEC& operator=(AVectorEC& g);
  917.  
  918. // To do debug printing:
  919.  
  920.         void debug_out(ostream& c, int indent);      
  921. };
  922.  
  923. // ***********************************************************************
  924.  
  925. class APoint: public GeOb
  926. {
  927.   public:
  928.  
  929. // Constructors:
  930.  
  931.     APoint(void)       : () {type = AFF_POINT;}
  932.         APoint(APoint& p)  : (p) {type = AFF_POINT;}
  933.     APoint(GeOb& a)    : (a.MapTo(AFF_POINT)) {type = AFF_POINT;}
  934.     APoint(Basis& s, ScalarList& a);
  935.     APoint(ASpace& s, GeObList& s);
  936.     APoint(ASpace& s, GeOb& v1, GeOb& v2);
  937.     APoint(ASpace& s, GeOb& v1, GeOb& v2, GeOb& v3);
  938.     APoint(MultiMap& mp) {type = AFF_POINT; *this = APoint(GeOb(mp));}
  939.     APoint(Map& mp)      {type = AFF_POINT; *this = APoint(GeOb(mp));}
  940.  
  941. // Mapping:
  942.  
  943.     virtual Boolean CanMapTo(GeObType t);
  944.     virtual GeOb MapTo(GeObType t);
  945.  
  946. // Assignment:
  947.  
  948.         APoint& operator=(APoint& g);
  949.  
  950. // To do debug printing:
  951.  
  952.         void debug_out(ostream& c, int indent);      
  953. };
  954.  
  955. // ***********************************************************************
  956.  
  957. class PPoint: public GeOb
  958. {
  959.   public:
  960.  
  961. // Constructors:
  962.  
  963.     PPoint(void)        : () {type = PROJ_POINT;}
  964.         PPoint(PPoint& v)   : (v) {type = PROJ_POINT;}
  965.     PPoint(GeOb& a)     : (a.MapTo(PROJ_POINT)) {type = PROJ_POINT;}
  966.     PPoint(MultiMap& mp) {type = PROJ_POINT; *this = PPoint(GeOb(mp));}
  967.     PPoint(Map& mp)      {type = PROJ_POINT; *this = PPoint(GeOb(mp));}
  968.     PPoint(HFrame& s, ScalarList& a);
  969.  
  970. // Mapping:
  971.  
  972.     virtual Boolean CanMapTo(GeObType t);
  973.     virtual GeOb MapTo(GeObType t);
  974.  
  975. // Assignment:
  976.  
  977.         PPoint& operator=(PPoint& g);
  978.  
  979. // To do debug printing:
  980.  
  981.         void debug_out(ostream& c, int indent);      
  982. };
  983.  
  984. // ***********************************************************************
  985.  
  986. class Map: public Object
  987. {
  988.   protected:
  989.  
  990. // Object Data:
  991.  
  992.     MapType type;
  993.     MapType holds;
  994.     Boolean invertible;
  995.     SubSet  range;
  996.         SubSet  domain;
  997.     Matrix  t;
  998.         Matrix  invt;
  999.     GeObType domtype;
  1000.     GeObType rettype;
  1001.     Boolean hasAL;
  1002.     Boolean isDefault;
  1003.  
  1004. // Functions used by Map & derived classes:
  1005.  
  1006.     Map(MapType t, Boolean i, SubSet& r,
  1007.             SubSet& d, Matrix& tm, Matrix& it, Boolean isdf,
  1008.         Boolean hal, GeObType dt, GeObType rt);
  1009.     Boolean ConvertList(GeObList& v, GeObType targ,
  1010.                 SubSet& dest, Matrix* hold);
  1011.     GeOb ApplyAL(GeOb& v);
  1012.     void data_out(ostream& c, int indent, char* name);
  1013.  
  1014. // Functions also used by friend classes.  Though the compiler cannot
  1015. // enforce it, friend classes (by convention) do not access any other
  1016. // private members of this class:  
  1017. // Used also by friend classes:
  1018.  
  1019.         friend class GeOb;
  1020.         friend class MultiMap;
  1021.         friend class ASubSet;
  1022.  
  1023.     Matrix&  MatrixRep(void)   {return (t);}
  1024.     GeObType DomainType(void)  {return (domtype);}
  1025.     GeObType ReturnType(void)  {return (rettype);}
  1026.  
  1027.   public:
  1028.  
  1029. // Creation:
  1030.  
  1031.         Map(void) {type = ANY_MAP; holds = NULL_MAP;}
  1032.         Map(Map& m);
  1033.     Map(MultiMap& m);
  1034.     Map(GeOb& g);
  1035.  
  1036. // Interrogation functions:
  1037.  
  1038.     SubSet  Range(void)        {return (range);}
  1039.     SubSet  Domain(void)       {return (domain);}
  1040.     MapType Holds(void)        {return (holds);}
  1041.     Boolean Invertible(void)   {return (invertible);}
  1042.  
  1043. // Functions to apply maps:
  1044.  
  1045.     GeOb operator()(GeOb& v);
  1046.  
  1047. // Functions that compose and invert maps:
  1048.  
  1049.     Map           Inv(void);
  1050.     Map           Compose(Map& m);
  1051.     ProjectiveMap ComposeProj(Map& m);
  1052.  
  1053. // Functions to obtain induced maps:
  1054.  
  1055.     ProjectiveMap InducedProjective(void);
  1056.     LinearMap     InducedLinear(void);
  1057.     LinearMap     Trans(void);
  1058.     LinearMap     AssocLinear(void);
  1059.     Vector        AssocDualVector(void);
  1060.  
  1061. // Assignment:
  1062.  
  1063.         Map& operator=(Map& m);
  1064.  
  1065. // To do debug printing:
  1066.  
  1067.         void debug_out(ostream& c, int indent);      
  1068. };
  1069.  
  1070. // ***********************************************************************
  1071.  
  1072. class LinearMap: public Map
  1073. {
  1074.   public:
  1075.  
  1076. // Creation:
  1077.  
  1078.     LinearMap(void)          : () {type = LIN_MAP;}
  1079.         LinearMap(LinearMap& m)  : (m) {type = LIN_MAP;}
  1080.     LinearMap(Map& m);
  1081.     LinearMap(MultiMap& m) {type = LIN_MAP; *this = LinearMap(Map(m));}
  1082.     LinearMap(GeOb& g)     {type = LIN_MAP; *this = LinearMap(Map(g));}
  1083.     LinearMap(VBasis& b1, VBasis& b2);
  1084.     LinearMap(VBasis& b, VSubSet& s, GeObList& v);
  1085.     LinearMap(VSubSet& s, GeObList& v, VBasis& b);
  1086.     LinearMap(VSubSet& s1, GeObList& v1, VSubSet& s2, GeObList& v2);
  1087.  
  1088. // Assignment:
  1089.  
  1090.         LinearMap& operator=(LinearMap& s);
  1091.  
  1092. // To do debug printing:
  1093.  
  1094.         void debug_out(ostream& c, int indent);      
  1095. };
  1096.  
  1097. // ***********************************************************************
  1098.  
  1099. class AffineMap: public Map
  1100. {
  1101.   private:
  1102.  
  1103. // Functions also used by friend classes.  Though the compiler cannot
  1104. // enforce it, friend classes (by convention) do not access any other
  1105. // private members of this class:  
  1106.  
  1107.         friend class Space;
  1108.         friend class VSpace;
  1109.         friend class ASpace;
  1110.         friend class PSpace;
  1111.  
  1112.     AffineMap(Space& s1, Space& s2);
  1113.     AffineMap(ProjectiveMap& lpm, AffineMap& lam);  //link 4,8
  1114.     AffineMap(AffineMap& apm, ProjectiveMap& lpm);  //link 5,9
  1115.  
  1116.   public:
  1117.  
  1118. // Creation:
  1119.  
  1120.     AffineMap(void)         : () {type = AFF_MAP;}
  1121.         AffineMap(AffineMap& m) : (m) {type = AFF_MAP;}
  1122.     AffineMap(Map& m);
  1123.     AffineMap(MultiMap& m)  {type = AFF_MAP; *this = AffineMap(Map(m));}
  1124.  
  1125.     AffineMap(Basis& b1, Basis& b2);
  1126.     AffineMap(Simplex& b, SubSet& s, GeObList& v);
  1127.     AffineMap(ASubSet& s, GeObList& v, Simplex& b);
  1128.     AffineMap(ASubSet& s1, GeObList& v1, SubSet& s2, GeObList& v2);
  1129.  
  1130. // Assignment:
  1131.  
  1132.         AffineMap& operator=(AffineMap& s);
  1133.  
  1134. // To do debug printing:
  1135.  
  1136.         void debug_out(ostream& c, int indent);      
  1137. };
  1138.  
  1139. // ***********************************************************************
  1140.  
  1141. class ProjectiveMap: public Map
  1142. {
  1143.   private:
  1144.  
  1145. // Functions also used by friend classes.  Though the compiler cannot
  1146. // enforce it, friend classes (by convention) do not access any other
  1147. // private members of this class:  
  1148.  
  1149.         friend class Space;
  1150.         friend class VSpace;
  1151.         friend class ASpace;
  1152.         friend class PSpace;
  1153.  
  1154.     ProjectiveMap(Space& s1, Space& s2);
  1155.     Boolean ScaleRows(Matrix* mat, Matrix& unit_pt);
  1156.     Boolean ConvertListUnit(GeObList& v, GeObType trg, SubSet& d,
  1157.                 Matrix* hold, Matrix* unit);
  1158.     ProjectiveMap(VSpace& L, AffineMap& lpm, PSpace& P);  //link 6,7
  1159.  
  1160.   public:
  1161.  
  1162. // Creation:
  1163.  
  1164.     ProjectiveMap(void)             : () {type = PROJ_MAP;}
  1165.         ProjectiveMap(ProjectiveMap& m) : (m) {type = PROJ_MAP;}
  1166.     ProjectiveMap(Map& m);
  1167.     ProjectiveMap(HFrame& b1, HFrame& b2);
  1168.     ProjectiveMap(HFrame& b, PSubSet& s, GeObList& v);
  1169.     ProjectiveMap(PSubSet& s, GeObList& v, HFrame& b);
  1170.     ProjectiveMap(PSubSet& s1, GeObList& v1, PSubSet& s2, GeObList& v2);
  1171.  
  1172. // Assignment:
  1173.  
  1174.         ProjectiveMap& operator=(ProjectiveMap& s);
  1175.  
  1176. // To do debug printing:
  1177.  
  1178.         void debug_out(ostream& c, int indent);      
  1179. };
  1180.  
  1181. // ***********************************************************************
  1182. //
  1183. // This class is used by MultiMaps for holding onto data.  It is ONLY
  1184. // intended to be used internally by the system.  It is included here
  1185. // because the subsequent MultiMap class declaration requires it.
  1186.  
  1187. // There is currently a limit of 10 symmetry sets.  Make this a global
  1188. // variable instead of a static class variable because it is needed by
  1189. // other classes too:
  1190.  
  1191. const int SYM_MAX = 10;
  1192.  
  1193. class MMData: public Object
  1194. {
  1195.   private:
  1196.  
  1197.         Matrix    t;             // Control net (Bezier or Hypercube);
  1198.         int       numsym;          // Number of symmetry sets
  1199.         int       deg[SYM_MAX];      // Degree of each symmetry set
  1200.         int       dim[SYM_MAX];      // Dimension of each symmetry set
  1201.         Boolean   isAntisym;         // True if map is antisymmetric
  1202.  
  1203.   public:
  1204.  
  1205. // Creation:
  1206.  
  1207.     MMData(void)             {numsym = 0;}
  1208.         MMData(MMData& m);
  1209.  
  1210. // Member functions:
  1211.  
  1212.     Matrix& Net(void)        {return (t);}
  1213.     int& Numsym(void)        {return (numsym);}
  1214.     Boolean& IsAntisym(void) {return (isAntisym);}
  1215.         // Caution! No bounds checking in following functions:
  1216.     int& Deg(int index)      {return (deg[index]);}
  1217.     int& Dim(int index)      {return (dim[index]);}
  1218.     int NetSize(void);
  1219.         int WhichSet(int argnum);
  1220.         void RemoveSymSet(int inset);
  1221.  
  1222. // Assignment:
  1223.  
  1224.         MMData& operator=(MMData& m);
  1225.  
  1226. // To do debug printing:
  1227.  
  1228.         void debug_out(ostream& c, int indent);      
  1229. };
  1230.  
  1231. // ***********************************************************************
  1232.  
  1233. class MultiMap: public Object
  1234. {
  1235.   protected:
  1236.  
  1237. // Object Data:
  1238.  
  1239.         MultiType type;
  1240.         MultiType holds;
  1241.     Boolean   fulleval;
  1242.     Space     range;
  1243.         Space     domain;
  1244.     MMData    data;
  1245.     GeObType  domtype;
  1246.     GeObType  rettype;
  1247.  
  1248. // Functions used by MultiMaps and derived classes:
  1249.  
  1250.     void Eval(int argnum, ScalarList& coords, MMData* rdat);
  1251.     void PtEval(ScalarList& c, MITuple* t, int el, MMData* rdat);
  1252.         void PtEvalAnti(ScalarList& c, MITuple* t, MMData* rdat,
  1253.             Matrix* newmat, Scalar oesign);
  1254.     void BasisArg(MITuple& tup, Space& s, GeObList* gl);
  1255.         void PartialEval(GeObList& t, SpaceList* nd, MultiMap* ret);
  1256.     void data_out(ostream& c, int indent, char* name);
  1257.  
  1258. // Functions also used by friend classes.  Though the compiler cannot
  1259. // enforce it, friend classes (by convention) do not access any other
  1260. // private members of this class:  
  1261.  
  1262.         friend class GeOb;
  1263.         friend class Map;
  1264.  
  1265.     GeObType DomainType(void)  {return (domtype);}
  1266.     GeObType RetType(void)     {return (rettype);}
  1267.     Boolean IsAntisym(void)    {return (data.IsAntisym());}
  1268.         // Caution!  User must first make sure map is fully evaluated!
  1269.     Matrix& FullEvalRep(void)  {return data.Net();};
  1270.     Matrix GetStdImage(int n);
  1271.  
  1272.   public:
  1273.  
  1274. // Creation:
  1275.  
  1276.     MultiMap(void)         {type = ANY_MULTI; holds = NULL_MULTI;}
  1277.     MultiMap(GeOb& s)      {type = ANY_MULTI; *this = MultiMap(Map(s));}
  1278.         MultiMap(MultiMap& v);
  1279.     MultiMap(Map& s);
  1280.  
  1281. // Interrogation functions:
  1282.  
  1283.     Space RangeSpace(void)        {return (range);}
  1284.     Space DomainSpace(void)       {return (domain);}  
  1285.     Boolean FullyEvaluated(void)  {return (fulleval);}  
  1286.     MultiType Holds(void)         {return (holds);}
  1287.  
  1288. // Typecasting: 
  1289.  
  1290.         Scalar ToScalar(void) {return (GeOb(*this).ToScalar());}
  1291.  
  1292. // Functions to apply maps and do partial evaluation:
  1293.  
  1294.     GeOb operator()(GeOb& t);
  1295.     MultiMap operator()(GeObList& t);
  1296.     MultiMap operator()(Space& newdom, GeObList& t);
  1297.  
  1298. // Assignment:
  1299.  
  1300.         MultiMap& operator=(MultiMap& s);
  1301.  
  1302. // To do debug printing:
  1303.  
  1304.         void debug_out(ostream& c, int indent);      
  1305. };
  1306.  
  1307. // ***********************************************************************
  1308.  
  1309. class MLM: public MultiMap
  1310. {
  1311.   private:
  1312.  
  1313. // Functions used by MLM:
  1314.  
  1315.     void DotProduct(VSpace& sp);
  1316.     Scalar DotResult(MITuple& tup);
  1317.     Matrix CrossResult(MITuple& tup, Basis& stdbas);
  1318.     void CrossProduct(VSpace& sp);
  1319.  
  1320. // Functions also used by friend classes.  Though the compiler cannot
  1321. // enforce it, friend classes (by convention) do not access any other
  1322. // private members of this class:  
  1323.  
  1324.         friend class Space;
  1325.  
  1326.     MLM(StdMaps mpt, VSpace& sp);
  1327.  
  1328.   public:
  1329.  
  1330. // Creation:
  1331.  
  1332.     MLM(void)   : () {type = MULTI_LINEAR;}
  1333.         MLM(MLM& m) : (m) {type = MULTI_LINEAR;}
  1334.     MLM(MultiMap& m);
  1335.     MLM(Map& s)  {type = MULTI_LINEAR; *this = MLM(MultiMap(s));}
  1336.     MLM(GeOb& s);
  1337.     MLM(VSpace& s1, IntList& symmetry, BasisList& bases,
  1338.         VSpace& s2, GeObList& vectors);
  1339.  
  1340. // Assignment:
  1341.  
  1342.         MLM& operator=(MLM& s);
  1343.  
  1344. // To do debug printing:
  1345.  
  1346.         void debug_out(ostream& c, int indent);      
  1347. };
  1348.  
  1349. // ***********************************************************************
  1350.  
  1351. class MAM: public MultiMap
  1352. {
  1353.   public:
  1354.  
  1355. // Creation:
  1356.  
  1357.     MAM(void)    : () {type = MULTI_AFFINE;}
  1358.         MAM(MAM& m)  : (m) {type = MULTI_AFFINE;}
  1359.     MAM(MultiMap& m);
  1360.     MAM(Map& m) {type = MULTI_AFFINE; *this = MAM(MultiMap(m));}
  1361.     MAM(ASpace& s1, IntList& symmetry, BasisList& simplices,
  1362.         Space& s2,  GeObList& images);
  1363.  
  1364. // Assignment:
  1365.  
  1366.         MAM& operator=(MAM& s);
  1367.  
  1368. // To do debug printing:
  1369.  
  1370.         void debug_out(ostream& c, int indent);      
  1371. };
  1372.  
  1373. // ***********************************************************************
  1374.  
  1375. class AugScalar: public Object
  1376. {
  1377.   protected:
  1378.  
  1379. // Object Data:
  1380.  
  1381.       Boolean is_inf;
  1382.     Matrix m;
  1383.  
  1384. // Functions used by cross ratio function:
  1385.  
  1386.     friend PPoint CrossRatio(AugScalar v, GeObList& g);
  1387.  
  1388.     Matrix& GetMatrix(void) {return m;}
  1389.  
  1390.   public:
  1391.  
  1392. // Creation:
  1393.  
  1394.     AugScalar(void);
  1395.     AugScalar(AugScalar& a);
  1396.      AugScalar(Scalar v);
  1397.     AugScalar(Infnum n);
  1398.  
  1399. // Interrogation functions:
  1400.  
  1401.     Scalar Value(void);
  1402.     Boolean IsInfinity(void)  {return is_inf;}
  1403.  
  1404. // Typecasting:
  1405.  
  1406.     operator Scalar();
  1407.  
  1408. // Assignment:
  1409.  
  1410.     AugScalar& operator=(AugScalar& a);
  1411.  
  1412. // To do debug printing:
  1413.  
  1414.         void debug_out(ostream& c, int indent);      
  1415. };
  1416.  
  1417. // ***********************************************************************
  1418. //
  1419. // Scalars can be converted to and from vectors in this special
  1420. // 1-dimensional space.  Declare the existence of this space:
  1421. //
  1422.  
  1423. extern VSpace Reals;
  1424.  
  1425. // ***********************************************************************
  1426. //
  1427. // Null geometric objects are useful for doing partial evaluation
  1428. // of multimaps.  Declare the existence of a standard null object:
  1429. //
  1430.  
  1431. extern GeOb NullGeOb;
  1432.  
  1433. #endif
  1434.